package com.boot.security.server.dao.user;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.boot.security.server.model.user.TswBankCard;

@Mapper
public interface TswBankCardDao {

    @Select("select * from tsw_bank_card t where t.id = #{id}")
    TswBankCard getById(Long id);

    @Delete("delete from tsw_bank_card where id = #{id}")
    int delete(Long id);

    int update(TswBankCard tswBankCard);
    
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into tsw_bank_card(user_id, user_name, extract_bank_name, extract_bank_province, extract_bank_city, extract_bank_subbranch, extract_bank_account, extract_bank_time, extract_bank_note, extract_bank_remark) values(#{userId}, #{userName}, #{extractBankName}, #{extractBankProvince}, #{extractBankCity}, #{extractBankSubbranch}, #{extractBankAccount}, #{extractBankTime}, #{extractBankNote}, #{extractBankRemark})")
    int save(TswBankCard tswBankCard);
    
    int count(@Param("params") Map<String, Object> params);

    List<TswBankCard> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);
}
